package com.jj.spb.spring_boot_mybatis.configs;

import org.hibernate.cfg.ImprovedNamingStrategy;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.internal.util.StringHelper;

import java.io.Serializable;
import java.util.Locale;

public class MoShopImprovedNamingStrategy extends ImprovedNamingStrategy
        implements NamingStrategy, Serializable{
    /**
     *
     */
    private static final long serialVersionUID = 3088474161734101900L;


    public String propertyToColumnName(String propertyName) {
        System.out.println("propertyToColumnName = " + propertyName );
        String name = StringHelper.unqualify(propertyName);
        StringBuilder buf = new StringBuilder(name.replace('.', '_'));
        return buf.toString().toLowerCase(Locale.ROOT);
    }

}
